<%--
 *  File:    contactsummary.jsp
 *  @Author: jianni 
 *  Date:    2001/12/10
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>


<%//--------------------------------------  setting logger --%>
<%Category cat = Category.getInstance("jsp.contactsummary");

			%>

<%//--------------------------------------  variant and initialization --%>
<%HashMap CurUserInfo = (HashMap) session.getAttribute("userinfo");
			String orgname = CurUserInfo.get("orgname").toString();

			%>
<%String strInfo = request.getParameter("info");
			strInfo = (strInfo == null) ? " " : strInfo;

			%>

<%//init param
			String privilegeCode = "ALL";
			String strModuleName = "COM";
			String strTableName = "v_zyllinkmansummary";
			String contextPath = request.getContextPath();

			%>

<%//--------------------------------------  include files list --%>

<%@ include file="/inc/PageDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc"%>


<html>
<head>
<title>contactsummary</title>
<PageFlow:CheckPageFlow pageName="p_contactsummary" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc"%>

<%//--------------------------------------  output variant from pageflow --%>
<%Vector contactsummary = (Vector) pageContext
					.getAttribute("contactsummary");
			if (contactsummary == null) {
				contactsummary = new Vector();
			}
			cat.debug("The contactsummary is :" + contactsummary);
%>

<script>


function page_setOrg(id,name)
{
  document.contactsummaryform.orgid.value = id;
  document.contactsummaryform.orgname.value = name;
  page_summary('search');
}

function clickContact(id,name,code)
{
  document.contactsummaryform.doctorid.value = id;
  document.contactsummaryform.doctorname.value = name;
  document.contactsummaryform.doctorcode.value = code;
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(contactsummaryform,actionvalue,orderbyname);
  editform.action = "popWindowContactInfo.jsp?<%= OvalTools.randomURL() %>"+"&orgid=1&languagecode=<%=strLanguageCode%>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
function radiotrue0(rid, vid,name,code)
{
	
	document.getElementById(rid).checked=true;
	clickContact(vid,name,code);
	
}
function setContactToOtherPage(){

	var id = document.contactsummaryform.doctorid.value;
  	var name= document.contactsummaryform.doctorname.value  ;
  	var code= document.contactsummaryform.doctorcode.value  ;
 	if(id =='' ||name==''||code==''){
 		id=document.getElementById('cbox1').value;
 		name=document.getElementById('contactname1').value;
 		code=document.getElementById('contactcode1').value;
 	}
 	opener.set_contactNameByPopWindow(id,name,code);
 	 window.close();
}

</script>
</head>

<body>

<%//--------------------------------------  hidden form variant --%>
<form name="contactsummaryform" method="post" action="../../Dispatcher"
	target="_parent"><input type="hidden" name="pagename"
	value="p_contactsummary"> <input type="hidden" name="actionname"> <input
	type=hidden name=info value="<%=strInfo%>"> <input type=hidden
	name=orgid value="<%=strInfo%>"> <%//--------------------------------------  page location --%>
<%--@ include file="/inc/PageLocation.inc" --%>
	<input type="hidden" name="doctorid"/>
	<input type="hidden" name="doctorname"/>
	<input type="hidden" name="doctorcode"/>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<table width="100%" border="0" cellspacing="0">
			<tr>

				<td>
				<table>
					<%@ include file="/inc/SummarySearch.inc"%>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<table width="100%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">

			<%//--------------------------------------  summary header --%>
			<tr class="deepblue-left">
				<td width="5%" class="title_center">&nbsp;</td>
				<td class="title_center"><a
					href="javascript:page_summary('orderby','doctorname')"><%=label.getLabelName("L_ContactName")%></a></td>
				<td width="6%" class="title_center"><a
					href="javascript:page_summary('orderby','gendername')"><%=label.getLabelName("L_GenderName")%></a></td>
				<td width="10%" class="title_center"><a
					href="javascript:page_summary('orderby','jobtitlename')"><%=label.getLabelName("L_Type1")%></a></td>
				<!-- 
				<td width="16%" class="title_center"><a
					href="javascript:page_summary('orderby','parentcontactid')"><%=label.getLabelName("L_ParentContact")%></a></td>
				 -->
				
				<td width="16%" class="title_center"><a
					href="javascript:page_summary('orderby','doctorcode')"><%=label.getLabelName("L_ContactCode")%></a></td>
				<td class="title_center"><a
					href="javascript:page_summary('orderby','email')"><%=label.getLabelName("L_Email")%></a></td>
				<td width="15%" class="title_center"><a
					href="javascript:page_summary('orderby','telephone')"><%=label.getLabelName("L_Telephone")%></a></td>
				<td width="15%" class="title_center"><a
					href="javascript:page_summary('orderby','statusname')"><%=label.getLabelName("L_Status")%></a></td>
			</tr>

			<%//--------------------------------------  default value definition --%>
			<%int i = 0;
			String strClassType = new String();
			Integer nDefaultContactId = new Integer(-1);
			String nDefaultContactName = "";
			boolean bHasChecked = false;

			%>

			<%//--------------------------------------  loop results --%>
			<logic:iterate id="contactsum" collection="<%= contactsummary %>">
				<%HashMap contactMap = (HashMap) pageContext
						.getAttribute("contactsum");
				String strIsDisabled = new String("");
				String strIsChecked = new String("");
				if (i % 2 == 1) {
					strClassType = "td-listrom";
				} else {
					strClassType = "";
				}

				if (!bHasChecked) {
					strIsChecked = "Checked";
					bHasChecked = true;
					nDefaultContactId = (Integer) (contactMap.get("doctorid"));
					nDefaultContactName = (String) (contactMap
							.get("doctorname"));
				}
				i++;

				%>

				<tr onMouseOver="this.className='tr-over'"
					onMouseOut="this.className='<%= strClassType %>'"
					onClick="javascript:radiotrue0('cbox<%= String.valueOf(i)%>', '<%= contactMap.get("doctorid") %>','<%=contactMap.get("doctorname")%>','<%=contactMap.get("doctorcode")%>')"
					class="<%= strClassType %>">
					<td><input id="cbox<%= String.valueOf(i)%>" type="radio"
						name="radiobutton" <%= strIsDisabled %>
						value=<%= contactMap.get("doctorid") %> class="checkbox"
						<%= strIsChecked%>
						onClick="javascript:clickContact('<%= contactMap.get("doctorid") %>','<%=contactMap.get("doctorname")%>','<%=contactMap.get("doctorcode")%>')">
					</td>
					<td>&nbsp;<%=contactMap.get("doctorname")%>
						<input type="hidden" id="contactname<%= String.valueOf(i)%>" value="<%=JspHelper.filterNull(contactMap.get("doctorname"))%>"/></td>
						<input type="hidden" id="contactcode<%= String.valueOf(i)%>" value="<%=JspHelper.filterNull(contactMap.get("doctorcode"))%>"/></td>
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("gendername"))%></td>
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("jobtitlename"))%></td>
					<!-- 
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("parentcontactname"))%></td>
					 -->
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("doctorcode"))%></td>
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("email"))%></td>
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("telephone"))%></td>
					<td>&nbsp;<%=JspHelper.filterNull(contactMap.get("statusname"))%></td>
				</tr>
			</logic:iterate>

			<%@ include file="/inc/SummaryAction.inc"%>
		</table>

		<%//--------------------------------------  page operation button --%>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center"><a
					onclick="javascript:setContactToOtherPage();"><custom:button
					type="1" label="L_Finish" imgsrc="finish.gif" border="0"
					style="width:60" /></a></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>


